﻿using System;
using System.Data;
using System.Web;
using System.IO;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Kml2Owl.Types;

namespace Kml2Owl.Services
{
    /// <summary>
    /// Descripción breve de GeoconceptsFramework
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class GeoconceptsFramework : System.Web.Services.WebService
    {

        /*
        [WebMethod]
        public string HelloWorld()
        {
            return "Hola a todos";
        }
         * */
        [WebMethod]
        protected Geoconcepts GeoconceptsDatasetFromKML(string kmlFilePath)
        {
            try
            {
                TcEngineServices oGisEngineServices = new TcEngineServices();
                return oGisEngineServices.GeoconceptsDatasetFromKML(kmlFilePath);
            }
            catch (Exception exc)
            {
                throw (exc);
            }
        }

        [WebMethod(Description = "Retrieves a list of Geoconcepts ordered by subjective relevance related to a given position. The results are given in OWL format complying with Geoconcepts ontology: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.2_20080326Lite_swrl.owl")]
        public string GeoconceptsWhereAmI(string strLat, string strLon)
        {
            string strResult = "";

            return strResult;
        }

        [WebMethod(Description = "Retrieves a list of Geoconcepts ordered by subjective relevance related to a given position and direction of view. The results are given in OWL format complying with Geoconcepts ontology: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.2_20080326Lite_swrl.owl")]
        public string GeoconceptsAmILookingAt(string strLatSource, string strLonSource, string strAngle, string strLatTarget, string strLonTarget)
        {
            string strResult = "";

            return strResult;
        }

        [WebMethod(Description = "Converts a KML file with features, polygons and centroids to an OWL file complying with Geoconcepts ontology: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.2_20080326Lite_swrl.owl")]
        public string ConvertKml2OwlTypeToOwl(string strFullPath)
        {
            // HABRÁ QUE VER CÓMO PASAMOS EL FICHERO KML, SI CON ARRAY DE BYTES, DATASET GENÉRICO, ETC.
            //

            #region Variables
            byte[] owlFile = null;
            Geoconcepts dtsGeoconceptTest = new Geoconcepts();
            string strResultado = "";
            #endregion Variables

            try
            {
                #region Fichero de Test si no se provee ningún fichero con datos
                if (strFullPath == null || strFullPath == "")
                {
                    strFullPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase) + "\\Test\\GeoconceptsTest.xml";
                }
                dtsGeoconceptTest.ReadXml(strFullPath);
                #endregion Fichero de Test si no se provee ningún fichero con datos

                #region Construimos el fichero RDF/OWL

                PelletServices svcPellet = new PelletServices();
                owlFile = svcPellet.ConvertGeoconceptsToOWL(dtsGeoconceptTest);

                strResultado = Ficheros.ConvertirBytesAFicheroTemporal(owlFile, "owl");
                #endregion Construimos el fichero RDF/OWL

                return strResultado;
                //return owlFile;
            }
            catch (DataException dataEx)
            {
                throw dataEx;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


        [WebMethod(Description = "Checks OWL file consistency according to Geoconcepts ontology: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.2_20080326Lite_swrl.owl")]
        private string CheckGeoconceptsOwlConsistency(string strFullPath)
        {
            #region Variables
            string strResultado = "";
            #endregion Variables

            try
            {
                PelletServices svcPellet = new PelletServices();
                strResultado = svcPellet.checkConsistencyWithJenaAndOntModel(strFullPath);

                return strResultado;
            }
            catch (DataException dataEx)
            {
                throw dataEx;
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        [WebMethod(Description = "Executes a CONSTRUCT SPARQL query over an OWL file. No inference extensions are provided. Test Example: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/Geoconcepts_Test_Sample_20080627.owl SPARQL trivial example: CONSTRUCT {?s ?p ?o .} WHERE {?s ?p ?o .}")]
        public string ExecuteCONSTRUCTOverInferredGraph(string strFullURL, string strQuery)
        {
            string strReturn = "";
            byte[] owlSubGraph = null;

            try
            {
                PelletServices svcPellet = new PelletServices();
                owlSubGraph = svcPellet.ExecuteCONSTRUCTOverInferredGraph(strFullURL, strQuery);

                strReturn = Ficheros.ConvertirBytesAFicheroTemporal(owlSubGraph, "owl");

                return strReturn;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod(Description = "Return all spatially related Geoconcepts for a given one and an OWL file complying with Geoconcepts ontology: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.2_20080326Lite_swrl.owl. The results are provided in the same OWL format Test Example: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/Geoconcepts_Test_Sample_20080627.owl")]
        public string RetrieveGConceptGeoGraph(string strFullURL, string strGeoConcept)
        {
            string strReturn = "";

            try
            {
                strReturn = RetrieveGConceptSetGeoGraph(strFullURL, strGeoConcept);
   
                return strReturn;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod(Description = "Return all spatially related Geoconcepts for a given set of Geoconcepts and an OWL file complying with Geoconcepts ontology: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.2_20080326Lite_swrl.owl. The results are provided in the same OWL format Test Example: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/Geoconcepts_Test_Sample_20080627.owl")]
        public string RetrieveGConceptSetGeoGraph(string strFullURL, string strGeoConceptSet)
        {
            #region Variables
            string strReturn = "";
            string strQuery = "";
            string[] strSeparator = new string[1];
            strSeparator[0] = ",";
            string[] strGCArray = strGeoConceptSet.Split(strSeparator, StringSplitOptions.RemoveEmptyEntries);
            #endregion Variables

            try
            {
                strQuery = "PREFIX gc:<http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.1_20080301Lite.owl#> " +
                    "CONSTRUCT {?s ?p ?o .} " +
                    "WHERE {?s ?p ?o . " +
                    "FILTER((?p = gc:isSpatialPartOf_High || " +
                    "?p = gc:isSpatialPartOf_Medium || " +
                    "?p = gc:isSpatialPartOf_Low || " +
                    "?p = gc:isSpatiallyEqual || " +
                    "?p = gc:isSpatialNeighbour_Low || " +
                    "?p = gc:isSpatialNeighbour_Medium || " +
                    "?p = gc:isSpatialNeighbour_High || " +
                    "?p = gc:hasSpatialPart_Low || " +
                    "?p = gc:hasSpatialPart_Medium || " +
                    "?p = gc:hasSpatialPart_High || " +
                    "?p = gc:hasNiceViewsOf_High || " +
                    "?p = gc:hasNiceViewsOf_Medium || " +
                    "?p = gc:hasNiceViewsOf_Low) && ((";

                for (int i = 0; i < strGCArray.Length - 1; i++)
                {
                    strQuery = strQuery + "?s = gc:" + strGCArray[i] + " || ";
                }
                strQuery = strQuery + "?s = gc:" + strGCArray[strGCArray.Length - 1] + ") || (";

                for (int i = 0; i < strGCArray.Length - 1; i++)
                {
                    strQuery = strQuery + "?o = gc:" + strGCArray[i] + " || ";
                }
                strQuery = strQuery + "?o = gc:" + strGCArray[strGCArray.Length - 1] + ")";

                strQuery = strQuery + "))}";

                strReturn = ExecuteCONSTRUCTOverInferredGraph(strFullURL, strQuery);

                return strReturn;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        [WebMethod(Description = "Return all spatial relations between a given set of Geoconcepts and an OWL file complying with Geoconcepts ontology: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.2_20080326Lite_swrl.owl. The results are provided in the same OWL format Test Example: http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/Geoconcepts_Test_Sample_20080627.owl")]
        public string RetrieveGConceptSetInterGeoGraph(string strFullURL, string strGeoConceptSet)
        {
            #region Variables
                string strReturn = "";
                string strQuery = "";
                string [] strSeparator = new string[1];
                strSeparator[0] = ",";
                string[] strGCArray = strGeoConceptSet.Split(strSeparator, StringSplitOptions.RemoveEmptyEntries);
            #endregion Variables

            try
            {
                strQuery = "PREFIX gc:<http://www.geospatialmeaning.eu/geo-ontologies-survey/GeoConcepts/GeoConcepts_v1.1_20080301Lite.owl#> " +
                    "CONSTRUCT {?s ?p ?o .} " +
                    "WHERE {?s ?p ?o . " +
                    "FILTER((?p = gc:isSpatialPartOf_High || " +
                    "?p = gc:isSpatialPartOf_Medium || " +
                    "?p = gc:isSpatialPartOf_Low || " +
                    "?p = gc:isSpatiallyEqual || " +
                    "?p = gc:isSpatialNeighbour_Low || " +
                    "?p = gc:isSpatialNeighbour_Medium || " +
                    "?p = gc:isSpatialNeighbour_High || " +
                    "?p = gc:hasSpatialPart_Low || " +
                    "?p = gc:hasSpatialPart_Medium || " +
                    "?p = gc:hasSpatialPart_High || " +
                    "?p = gc:hasNiceViewsOf_High || " +
                    "?p = gc:hasNiceViewsOf_Medium || " +
                    "?p = gc:hasNiceViewsOf_Low) && (";

                for (int i = 0; i < strGCArray.Length - 1; i++)
                {
                    strQuery = strQuery + "?s = gc:" + strGCArray[i] + " || ";
                }
                strQuery = strQuery + "?s = gc:" + strGCArray[strGCArray.Length - 1] + ") && (";

                for (int i = 0; i < strGCArray.Length - 1; i++)
                {
                    strQuery = strQuery + "?o = gc:" + strGCArray[i] + " || ";
                }
                strQuery = strQuery + "?o = gc:" + strGCArray[strGCArray.Length - 1] + ")";
                
               strQuery = strQuery + ")}";

                strReturn = ExecuteCONSTRUCTOverInferredGraph(strFullURL, strQuery);
               
                return strReturn;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #region Auxiliar Ejemplo Dataset
        [WebMethod]
        private void CrearEjemploDataset()
        {
            Geoconcepts dtsGeoconcepts = new Geoconcepts("");
            
            try
            {
                /*
                // La Concha
                
                dtsGeoconcepts.GeoconceptsItems.AddGeoconceptsItemsRow("laconcha", "100", "0", "0");
                Geoconcepts.PolygonsRow drPolygons = dtsGeoconcepts.Polygons.NewPolygonsRow();

                drPolygons.Geoconcept = "laconcha";
                drPolygons.Polygon = "p_laconcha1";
                drPolygons.NumPoints = "100";
                drPolygons.Points = "-1.9947,43.31463,0 -1.99614,43.31466,0 -1.99831,43.31509,0 -1.9996,43.31531,0 -2.0026,43.31694,0 -2.00912,43.32043,0 -2.00518,43.32006,0 -2.00191,43.31843,0 -1.99951,43.31744,0 -1.99402,43.31744,0 -1.99076,43.31893,0 -1.9867,43.32157,0 -1.98466,43.32087,0 -1.98333,43.31667,0 -1.98852,43.31506,0 -1.9923,43.3145,0 -1.99325,43.31452,0 -1.9947,43.31463,0";
                drPolygons.ElevationMax = "0";
                drPolygons.ElevationMin = "0";

                dtsGeoconcepts.Polygons.AddPolygonsRow(drPolygons);

                Geoconcepts.CentroidsRow drCentroids = dtsGeoconcepts.Centroids.NewCentroidsRow();

                drCentroids.Polygon = "p_laconcha1";
                drCentroids.Centroid = "c_laconcha1";
                drCentroids.Point = "-1.99289,43.31743";
                drCentroids.Elevation = "0";

                dtsGeoconcepts.Centroids.AddCentroidsRow(drCentroids);
                           
                dtsGeoconcepts.AcceptChanges();

                // Playa de la concha

                dtsGeoconcepts.GeoconceptsItems.AddGeoconceptsItemsRow("playalaconcha", "100", "0", "0");
                drPolygons = dtsGeoconcepts.Polygons.NewPolygonsRow();

                drPolygons.Geoconcept = "playalaconcha";
                drPolygons.Polygon = "p_playalaconcha1";
                drPolygons.NumPoints = "100";
                drPolygons.Points = "-1.9947,43.31463,0 -1.99614,43.31466,0 -1.99831,43.31509,0 -1.9996,43.31531,0 -2.0026,43.31694,0 -2.00912,43.32043,0 -2.00518,43.32006,0 -2.00191,43.31843,0 -1.99951,43.31744,0 -1.99402,43.31744,0 -1.99076,43.31893,0 -1.9867,43.32157,0 -1.98466,43.32087,0 -1.98333,43.31667,0 -1.98852,43.31506,0 -1.9923,43.3145,0 -1.99325,43.31452,0 -1.9947,43.31463,0";
                drPolygons.ElevationMax = "0";
                drPolygons.ElevationMin = "0";

                dtsGeoconcepts.Polygons.AddPolygonsRow(drPolygons);

                drCentroids = dtsGeoconcepts.Centroids.NewCentroidsRow();

                drCentroids.Polygon = "p_playalaconcha1";
                drCentroids.Centroid = "c_playalaconcha1";
                drCentroids.Point = "-1.99289,43.31743";
                drCentroids.Elevation = "0";

                dtsGeoconcepts.Centroids.AddCentroidsRow(drCentroids);

                dtsGeoconcepts.AcceptChanges();


                // Ayuntamiento

                dtsGeoconcepts.GeoconceptsItems.AddGeoconceptsItemsRow("ayuntamiento", "50", "10", "10");
                drPolygons = dtsGeoconcepts.Polygons.NewPolygonsRow();

                drPolygons.Geoconcept = "ayuntamiento";
                drPolygons.Polygon = "p_ayuntamiento1";
                drPolygons.NumPoints = "30";
                drPolygons.Points = "-1.98483,43.32146,0 -1.98492,43.32109,0 -1.98484,43.32063,0 -1.98509,43.32051,0 -1.9855,43.3204,0 -1.98612,43.3209,0 -1.98681,43.32131,0 -1.98655,43.32224,0 -1.98589,43.32176,0 -1.98565,43.32165,0 -1.98501,43.32138,0 -1.98483,43.32146,0";
                drPolygons.ElevationMax = "10";
                drPolygons.ElevationMin = "10";

                dtsGeoconcepts.Polygons.AddPolygonsRow(drPolygons);

                drCentroids = dtsGeoconcepts.Centroids.NewCentroidsRow();

                drCentroids.Polygon = "p_ayuntamiento1";
                drCentroids.Centroid = "c_ayuntamiento1";
                drCentroids.Point = "-1.9858,43.32124";
                drCentroids.Elevation = "10";

                dtsGeoconcepts.Centroids.AddCentroidsRow(drCentroids);

                drPolygons = dtsGeoconcepts.Polygons.NewPolygonsRow();

                drPolygons.Geoconcept = "ayuntamiento";
                drPolygons.Polygon = "p_ayuntamiento2";
                drPolygons.NumPoints = "20";
                drPolygons.Points = "-1.98578,43.31881,0 -1.98629,43.31950000000001,0 -1.98569,43.31943,0 -1.98501,43.31987000000001,0 -1.98509,43.31937,0 -1.98509,43.31881,0 -1.98578,43.31881,0";
                drPolygons.ElevationMax = "10";
                drPolygons.ElevationMin = "10";

                dtsGeoconcepts.Polygons.AddPolygonsRow(drPolygons);

                drCentroids = dtsGeoconcepts.Centroids.NewCentroidsRow();

                drCentroids.Polygon = "p_ayuntamiento2";
                drCentroids.Centroid = "c_ayuntamiento2";
                drCentroids.Point = "-1.98552,43.31923";
                drCentroids.Elevation = "10";

                dtsGeoconcepts.Centroids.AddCentroidsRow(drCentroids);


                dtsGeoconcepts.AcceptChanges();

                // NiceViewsOf Ayuntamiento
                dtsGeoconcepts.GeoconceptsItems.AddGeoconceptsItemsRow("hnv_ayuntamiento", "20", "10", "10");

                  drPolygons = dtsGeoconcepts.Polygons.NewPolygonsRow();

                drPolygons.Geoconcept = "hnv_ayuntamiento";
                drPolygons.Polygon = "p_hnv_ayuntamiento1";
                drPolygons.NumPoints = "20";
                drPolygons.Points = "-1.98578,43.31881,0 -1.98629,43.31950000000001,0 -1.98569,43.31943,0 -1.98501,43.31987000000001,0 -1.98509,43.31937,0 -1.98509,43.31881,0 -1.98578,43.31881,0";
                drPolygons.ElevationMax = "10";
                drPolygons.ElevationMin = "10";

                dtsGeoconcepts.Polygons.AddPolygonsRow(drPolygons);

                drCentroids = dtsGeoconcepts.Centroids.NewCentroidsRow();

                drCentroids.Polygon = "p_hnv_ayuntamiento1";
                drCentroids.Centroid = "c_hnv_ayuntamiento1";
                drCentroids.Point = "-1.98552,43.31923";
                drCentroids.Elevation = "10";

                dtsGeoconcepts.Centroids.AddCentroidsRow(drCentroids);

                 dtsGeoconcepts.AcceptChanges();
                // Puerto Pesquero

                dtsGeoconcepts.GeoconceptsItems.AddGeoconceptsItemsRow("puertopesquero", "20", "10", "10");
                drPolygons = dtsGeoconcepts.Polygons.NewPolygonsRow();

                drPolygons.Geoconcept = "puertopesquero";
                drPolygons.Polygon = "p_puertopesquero1";
                drPolygons.NumPoints = "100";
                drPolygons.Points = "-1.98805,43.32284,0 -1.98728,43.32206,0 -1.98887,43.32243,0 -1.99001,43.32301,0 -1.98848,43.32299,0 -1.98805,43.32284,0";
                drPolygons.ElevationMax = "0";
                drPolygons.ElevationMin = "0";

                dtsGeoconcepts.Polygons.AddPolygonsRow(drPolygons);

                drCentroids = dtsGeoconcepts.Centroids.NewCentroidsRow();

                drCentroids.Polygon = "p_puertopesquero1";
                drCentroids.Centroid = "c_puertopesquero1";
                drCentroids.Point = "-1.98855,43.32264";
                drCentroids.Elevation = "0";

                dtsGeoconcepts.Centroids.AddCentroidsRow(drCentroids);

                dtsGeoconcepts.AcceptChanges();


                Geoconcepts.GeoconceptsRelationsRow drGeoconceptsRelation = dtsGeoconcepts.GeoconceptsRelations.NewGeoconceptsRelationsRow();
                drGeoconceptsRelation.Geoconcept = "hnv_ayuntamiento";
                drGeoconceptsRelation.RelationShip = "hasNiceViewsOf_High";
                drGeoconceptsRelation.GeoconceptTarget = "ayuntamiento";

                dtsGeoconcepts.GeoconceptsRelations.AddGeoconceptsRelationsRow(drGeoconceptsRelation);
                dtsGeoconcepts.AcceptChanges();

                drGeoconceptsRelation = dtsGeoconcepts.GeoconceptsRelations.NewGeoconceptsRelationsRow();

                drGeoconceptsRelation.Geoconcept = "ayuntamiento";
                drGeoconceptsRelation.RelationShip = "isSpatialNeighbour_Low";
                drGeoconceptsRelation.GeoconceptTarget = "puertopesquero";

                dtsGeoconcepts.GeoconceptsRelations.AddGeoconceptsRelationsRow(drGeoconceptsRelation);
                dtsGeoconcepts.AcceptChanges();
                drGeoconceptsRelation = dtsGeoconcepts.GeoconceptsRelations.NewGeoconceptsRelationsRow();

                drGeoconceptsRelation.Geoconcept = "ayuntamiento";
                drGeoconceptsRelation.RelationShip = "isSpatialPartOf_High";
                drGeoconceptsRelation.GeoconceptTarget = "playalaconcha";

                dtsGeoconcepts.GeoconceptsRelations.AddGeoconceptsRelationsRow(drGeoconceptsRelation);
                dtsGeoconcepts.AcceptChanges();
                drGeoconceptsRelation = dtsGeoconcepts.GeoconceptsRelations.NewGeoconceptsRelationsRow();

                drGeoconceptsRelation.Geoconcept = "puertopesquero";
                drGeoconceptsRelation.RelationShip = "isSpatialPartOf_Medium";
                drGeoconceptsRelation.GeoconceptTarget = "playalaconcha";

                dtsGeoconcepts.GeoconceptsRelations.AddGeoconceptsRelationsRow(drGeoconceptsRelation);
                dtsGeoconcepts.AcceptChanges();
                drGeoconceptsRelation = dtsGeoconcepts.GeoconceptsRelations.NewGeoconceptsRelationsRow();

                drGeoconceptsRelation.Geoconcept = "playalaconcha";
                drGeoconceptsRelation.RelationShip = "isSpatialPartOf_High";
                drGeoconceptsRelation.GeoconceptTarget = "laconcha";

                dtsGeoconcepts.GeoconceptsRelations.AddGeoconceptsRelationsRow(drGeoconceptsRelation);
                dtsGeoconcepts.AcceptChanges();

                dtsGeoconcepts.WriteXml("C:\\Documents and Settings\\Javier\\Escritorio\\EQUIS\\GeoconceptsTest.xml");
                */

                // Creación de XML con relaciones
                /*
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("hasNiceViewsOf_High"); 
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("hasNiceViewsOf_Medium");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("hasNiceViewsOf_Low");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("isSpatialPartOf_Low");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("isSpatialPartOf_Medium");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("isSpatialPartOf_High");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("isSpatialNeighbour_Low");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("isSpatialNeighbour_Medium");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("isSpatialNeighbour_High");
                dtsGeoconcepts.RelationShips.AddRelationShipsRow("isSpatiallyEqual");

                dtsGeoconcepts.AcceptChanges();

                dtsGeoconcepts.WriteXml("C:\\Documents and Settings\\Javier\\Escritorio\\EQUIS\\Relationships.xml");
                 * */
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        #endregion Auxiliar Ejemplo Dataset

        #region Auxiliar Test de Funcionamiento
        [WebMethod(Description = "El Test por defecto es testAboxTbox()")]
        private string PelletTests(int nNumeroTest)
        {
            string strResultado = "";

            try
            {
                switch (nNumeroTest)
                {
                    case 1:
                        strResultado = "";
                        break;
                    default:
                        PelletServices svcPellet = new PelletServices();
                        strResultado = svcPellet.testAboxTbox();
                        break;
                }
                return strResultado;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion Auxiliar Test de Funcionamiento
    }
}
